package org.ckq.base;

/**
 * Created by chenkaiqing on 17/8/16.
 */
public class Array {
    public static final <T>void copy(T[] source,T[] target){
        int len = source.length>target.length ? target.length : source.length;
        for(int i=0;i<len;i++){
            target[i] = source[i];
        }
    }
    public static final void copy(byte[] source,byte[] target){
        int len = source.length>target.length ? target.length : source.length;
        for(int i=0;i<len;i++){
            target[i] = source[i];
        }
    }
    public static final void copy(short[] source,short[] target){
        int len = source.length>target.length ? target.length : source.length;
        for(int i=0;i<len;i++){
            target[i] = source[i];
        }
    }
    public static final void copy(int[] source,int[] target){
        int len = source.length>target.length ? target.length : source.length;
        for(int i=0;i<len;i++){
            target[i] = source[i];
        }
    }
    public static final void copy(long[] source,long[] target){
        int len = source.length>target.length ? target.length : source.length;
        for(int i=0;i<len;i++){
            target[i] = source[i];
        }
    }
    public static final void copy(char[] source,char[] target){
        int len = source.length>target.length ? target.length : source.length;
        for(int i=0;i<len;i++){
            target[i] = source[i];
        }
    }
    public static final void copy(boolean[] source,boolean[] target){
        int len = source.length>target.length ? target.length : source.length;
        for(int i=0;i<len;i++){
            target[i] = source[i];
        }
    }
    public static final void copy(float[] source,float[] target){
        int len = source.length>target.length ? target.length : source.length;
        for(int i=0;i<len;i++){
            target[i] = source[i];
        }
    }
    public static final void copy(double[] source,double[] target){
        int len = source.length>target.length ? target.length : source.length;
        for(int i=0;i<len;i++){
            target[i] = source[i];
        }
    }
}
